import { defineStore } from 'pinia'
import { computed, ref } from 'vue'

export const useCounterStore = defineStore(
  'counter',
  () => {
    // 定义 state
    const count = ref(0)
    const text1 = ref('text1')

    // 定义 getters
    const double = computed(() => count.value * 2)

    // 定义 actions
    const increment = () => {
      count.value++
    }

    const decrement = () => {
      count.value--
    }

    return { count, increment, decrement, double,text1 }
  },
  {
    unistorage: {
      paths: ['count','text1'],
    },
  }
)
